<?php

/**
 * GcAluno form.
 *
 * @package    GC
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class GcAlunoForm extends BaseGcAlunoForm {

    public function configure() {
        unset($this['created_at'], $this['updated_at']);




        $this->widgetSchema['gc_disciplinas_list'] = new sfWidgetFormDoctrineChoice(array(
                    'label' => 'Disciplinas',
                    'model' => 'GcDisciplina',
                    'order_by' => array('nome', 'asc'),
                    'expanded' => true,
                    'multiple' => true,
                ));


        $this->setValidators(array(
            'id' => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
            'nome' => new sfValidatorString(array('max_length' => 20)),
            'turma' => new sfValidatorString(array('max_length' => 4)),
            'gc_disciplinas_list' => new sfValidatorDoctrineChoice(array('model' => 'GcDisciplina', 'column' => 'id', 'multiple' => true)),
        ));

        $this->validatorSchema['gc_disciplinas_list'] = new sfValidatorDoctrineChoice(array('model' => 'GcDisciplina', 'column' => 'id', 'multiple' => true));
//        $this->widgetSchema['gc_disciplinas_list']
        foreach ($this->object->getGcAlunoDisciplina() as $i => $aluno_disciplina) {
            $form = new GcAlunoDisciplinaForm($aluno_disciplina);
            $this->embedForm($aluno_disciplina->getGcDisciplina()->getNome(), $form);
        }
    }

}
